<template>
	<view class="container">
		<!-- 小程序列表 -->
		<view class="friend-two-w">
			<view class="friend-two-friend" v-for="(pos ,index) in LinkList" :key="pos.appid" @tap="posTap">
				<view class="friend-two-img">
					<image class="fengrui-img" :src="pos.url" mode="aspectFill"></image>
				</view>
				<view class="friend-two-title">
					{{ pos.link_title}}
				</view>
				<view class="friend-two-abstract">
					{{pos.link_introduce}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	export default {
		data() {
			return {
				// 小程序列表
				LinkList: [],
				page: 1,
				pageSize: 10
			}

		},
		onLoad() {
			this.getLinkList();
		},
		methods: {
			posTap: function(e) {

			},
			//获取友链
			getLinkList: function() {
				var that = this;
				var postData = {
					page: that.page,
					pageSize: that.pageSize
				}
				//传输信息
				app.request('/Link/getLinkList', postData, 'GET',
					function(res) {
						if (res.data.code == 1) {
							that.LinkList = res.data.data
						} else {
							uni.showToast({
								icon: "none",
								title: "暂无数据"
							})
						}
						console.log('成功');
						console.log(res);
					},
					function(res) {
						console.log('失败');
						console.log(res);
					},
					function(res) {
						console.log('完成');
						console.log(res);
					}
				);
			}
		},
		// 分享小程序界面
		onShareAppMessage(res) {
			if (res.from === 'button') { // 来自页面内分享按钮
				console.log(res.target)
			}
			return {
				title: '小程序名字id',
				path: '/pages/index/index',
				imageUrl: ''
			}

		},
	}
</script>

<style>
	/* 小程序列表 */

	.friend-two-abstract {
		color: #ADADAD;
		font-size: 28rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		margin-top: 10rpx;
		height: 80rpx;
	}

	.friend-two-title {
		font-size: 30rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		margin-top: 16rpx;
	}

	.friend-two-img {
		width: 100%;
		height: 260rpx;
		border-radius: 20rpx;
		overflow: hidden;
	}

	.friend-two-friend {
		border-radius: 20rpx;
		overflow: hidden;
		flex-shrink: 0;
		width: 46%;
		margin-bottom: 40rpx;
	}

	.friend-two-w {
		margin: 20rpx 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex-wrap: wrap;
	}

	.container {
		padding: 40rpx;
	}

	.fengrui-img {
		height: 100%;
		width: 100%;
	}
</style>
